# -*- coding: utf-8 -*-
# !/usr/bin/env python
from utils.mysql_utils import query_to_list


def query_projct_package(project_id=''):
    sql_parameter = []

    if project_id:
        sql_fragment = "AND a.project_id = %s"
        sql_parameter.append(project_id)
    else:
        sql_fragment = ''

    sql = """
    SELECT *
    FROM package_management a
    WHERE a.`status` = 1
    %s
    """%sql_fragment
    data = query_to_list(sql, sql_parameter, False)

    return data